<template>
  <card ref="Card">
    <div slot="header">
      <!--<el-input v-model="searchDate" placeholder="输入名称" clearable class="w-200" @keyup.enter.native="getData"/>-->
      <el-date-picker v-model="searchDate" type="date" placeholder="选择日期搜索" value-format="yyyy-MM-dd" @change="getData"/>
      <el-button type="success" class="el-icon-search ml-5" @click="getData">搜索</el-button>
      <el-button type="warning" class="float-right" @click="joinProblem" :disabled="numberList.length === 0">问题件</el-button>
    </div>
    <el-table :data="formData" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column prop="number" label="订单号" width="165"></el-table-column>
      <el-table-column prop="senderName" label="寄件人姓名"></el-table-column>
      <el-table-column prop="senderPhone" label="寄件人联系电话"></el-table-column>
      <el-table-column prop="receiverName" label="收件人姓名"></el-table-column>
      <el-table-column prop="receiverPhone" label="收件人联系电话"></el-table-column>
      <el-table-column label="更新时间" show-overflow-tooltip>
        <template slot-scope="scope">
          <span>{{scope.row.updateTime | formatDateTime}}</span>
        </template>
      </el-table-column>
      <el-table-column label="状态" width="70">
        <template slot-scope="scope">
          <span>{{$state(scope.row.state)}}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination ref="Pagination" @update="getData"/>
  </card>
</template>

<script>
  import {pageOughtOutApi} from '@/api/repertory';
  import JS from '../js'

  export default {
    name: "Page1",
    mixins: [JS],
    mounted() {
      this.getData()
    },
    methods: {
      getData() {
        let pagination = this.$refs.Pagination;
        if (!this.searchDate) this.searchDate = this.getToday()
        let param = {
          current: pagination.current,
          size: pagination.size,
          localDateStr: this.searchDate
        };
        this.$refs.Card.start();
        pageOughtOutApi(param).then(result => {
          let response = result.resultParam.expressOrderPage;
          this.formData = response.records;
          pagination.total = response.total;
          this.$refs.Card.stop();
        })
      }
    }
  }
</script>
